<template>
  <div class="search-enterprise" v-if="props.showDialog">
    <Dialog
      diaTop="5"
      headerName="企业列表"
      :showDialog="true"
      @close="close"
      @save="save"
      saveLetter="保存"
      diaWidth="80"
      footerTop="22"
      footerBtm="30"
      :footerShow="false"
    >
      <template #content>
        <div class="content-wrap">
          <el-form ref="form" :model="formData">
            <el-row :gutter="20">
              <el-col :span="6">
                <el-form-item label="企业名称：">
                  <el-input clearable v-model="formData.customername" />
                </el-form-item>
              </el-col>

              <el-col :span="6">
                <el-form-item label="企业类别：" label-width="120px">
                  <el-input clearable v-model="formData.managementtype" />
                  <!-- <el-select
                    v-model="formData.managementtype"
                    clearable
                    placeholder="请选择"
                  >
                    <el-option
                      v-for="item in enterpriseTypeList"
                      :key="item.value"
                      :label="item.label"
                      :value="item.value"
                    />
                  </el-select> -->
                </el-form-item>
              </el-col>
              <!-- <el-col :span="6">
                <el-form-item label="排污许可证号：" label-width="100px">
                 
                  <el-input clearable v-model="formData.creditcode" />
                </el-form-item>
              </el-col> -->

              <el-col :span="6">
                <el-button type="primary" @click="getList"
                  ><el-icon style="color: #fff; margin-right: 5px"
                    ><Search /></el-icon
                  >查询</el-button
                >
              </el-col>
            </el-row>
          </el-form>
        </div>
        <div class="table-wrap data-wrap">
          <el-table
            :data="dataList"
            border
            class="table-height"
            style="width: 100%"
          >
            <!-- <el-table-column type="selection" align="center" /> -->
            <el-table-column
              prop="customername"
              align="center"
              label="企业名称"
            />
            <el-table-column
              prop="managementtype"
              align="center"
              label="企业类别"
            />
            <!-- <el-table-column prop="name" align="center" label="排污许可证号" /> -->
            <el-table-column
              prop="hbperson"
              align="center"
              label="联系人"
              width="120"
            />
            <el-table-column prop="hbmobile" align="center" label="手机号" />
            <el-table-column
              prop="customeraddress"
              align="center"
              label="企业地址"
            />

            <el-table-column label="查看状态" width="120" align="center">
              <template #default="{ row }">
                <div
                  class="search-done"
                  :style="[
                    { color: row.viewflag == 1 ? '#0874fa' : '#FF0000' },
                  ]"
                >
                  {{ row.viewflag == 1 ? "已查看" : "未查看" }}
                </div>
                <!-- 未查看 c  -->
              </template>
            </el-table-column>
            <el-table-column label="执行状态" width="120" align="center">
              <template #default="{ row }">
                <div
                  class="have-done"
                  :style="[
                    { color: row.followflag == 1 ? '#0874fa' : '#FF0000' },
                  ]"
                >
                  {{ row.followflag == 1 ? "已执行" : "未执行" }}
                </div>
                <!--未执行 c #FF0000 -->
              </template>
            </el-table-column>
          </el-table>
          <div
            style="padding-right: 60px; margin-top: 25px; padding-bottom: 35px"
          >
            <Pagination
              :model-value:currentPage="formData.page"
              :total="total"
              :model-value:page-size="formData.pagesize"
              @getDataList="getList"
            />
          </div>
        </div>
      </template>
    </Dialog>
  </div>
</template>
<script setup>
import Dialog from "@/components/DialogCross";
import ElMessage from "@/components/ElMessage.js";
import Upload from "@/components/Upload";
let props = defineProps(["showDialog", "addOrEditFlag", "sendIds"]);
let emit = defineEmits(["update:showDialog", "save"]);
import http from "@http";
let getList = () => {
  http({
    url: "/admPCNoticeGroupDetail/datalist",
    data: formData,
  }).then((res) => {
    if (res.code == 0) {
      dataList.value = res.data.list;

      total.value = res.data.total;
      ElMessage({ msg: "查询成功" });
    }
  });
};

let params = reactive({});
let statusList = ref([]);
let enterpriseTypeList = ref([]);
let formData = reactive({ page: 1, pagesize: 10 });
let dataList = ref([]);
let total = ref(1);

let close = () => {
  emit("update:showDialog", false);
};
let save = () => {
  emit("save");
};
watch(
  () => props.sendIds,
  (newVal) => {
    // console.log(props.sendIds);
    formData.groupid = Number(newVal);
    getList();
  },
  { deep: true, immediate: true }
);
let handleSearch = () => {};
let options = ref([{ label: "fds,", value: "2" }]);
http({ url: "/listitem/getmodule", data: { module: "B06" } }).then((res) => {
  if (res.code == 0) {
    statusList.value = res.data.map((item) => {
      return {
        label: item.name,
        value: item.id,
      };
    });
  }
});
http({ url: "/listitem/getmodule", data: { module: "B05" } }).then((res) => {
  if (res.code == 0) {
    enterpriseTypeList.value = res.data.map((item) => {
      return {
        label: item.name,
        value: item.id,
      };
    });
  }
});
</script>
<style lang="scss" scoped>
.search-enterprise {
  .content-wrap {
    padding-right: 20px;
    padding-left: 20px;
  }
  .table-height {
    height: 64.5vh;
  }
  :deep(.el-form-item__label) {
    font-family: Source Han Sans CN;
    font-weight: 500 !important;
    font-size: 20px !important;
    color: #000 !important;
  }
  :deep(.el-input) {
    width: 100%;
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
    color: #666666 !important;
  }
  :deep(.el-select) {
    width: 100% !important;

    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
    color: #666666 !important;
  }
  :deep(.el-input__inner) {
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
    color: #333;
  }
  :deep(.el-input) {
    width: 100% !important;
  }
  :deep(.el-input__wrapper, .el-textarea__inner) {
    box-shadow: none;
    font-family: Source Han Sans CN;
    font-weight: 400 !important;
    font-size: 18px !important;
    color: #666666 !important;
    background: #fff !important;
    border-radius: 5px !important;
    border: 1px solid #bfbfbf !important;

    height: 37px !important;
  }
  :deep(.el-input__inner::placeholder) {
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
    color: #999999;
  }
  :deep(.el-button.el-button--primary) {
    width: 89px;
    margin-top: 6px;
    margin-left: 20px;

    height: 37px;
    font-size: 20px;

    background: #0874fa;
    border-radius: 4px;
  }
  .search-done {
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
  }
  .have-done {
    font-family: Source Han Sans CN;
    font-weight: 400;
    font-size: 18px;
  }
  .pagina {
    :deep(.el-input--default.el-input--suffix) {
      width: 120px !important;
    }
    :deep(.el-input__wrapper) {
      width: 70px !important;
    }
  }
}
</style>
